<!--
 * @author Santa Antilles
 * @description 发表评论的组件
 * @date 2023/12/27-00:42:08
 * -->
<template>
  <div style="margin: 10px;">
    <div class="demo-rate-block">
      <span class="demonstration">评分</span>
      <el-rate v-model="form.commentScore" :show-score="true"/>
    </div>
    <el-input
        v-model="form.commentContent"
        :autosize="{ minRows: 3, maxRows: 4 }"
        type="textarea"
        placeholder="Please input"
        style="margin-top: 10px"
    />
    <el-button type="submit" class="submit" style="margin-top: 10px" @click="addComments()">评论</el-button></div>

</template>

<script setup>
import { ref } from 'vue'
import {addComment} from "@/web-api/DishAndRes_User/dish-comment.js";

const props = defineProps({
  dishId:String,
  userId:String
})
let form = reactive({
  commentScore:null,
  commentContent:null,
  dishId:props.dishId,
  userId:props.userId,
})

const addComments=()=>{
  console.log("form",form);
  addComment(form);
  location.reload();
}
</script>

<style scoped>
</style>